package org.example.seckill.controller;

import org.example.seckill.dao.ProductMapper;
import org.example.seckill.dao.pojo.Product;
import org.example.seckill.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class SeckillController {

    @Autowired
    private SeckillService seckillService;

    @Autowired
    private ProductMapper productMapper;

    @RequestMapping(path = "/seckill", method = RequestMethod.POST)
    public String makeSeckills(Integer aInventory) {
        seckillService.makeSeckill(aInventory);
        return "批量秒杀完成！";
    }

    @RequestMapping(path = "/inventory", method = RequestMethod.GET)
    public String invenory() {
        Product product = productMapper.findById(1);
        return product.toString();
    }
}
